package com.yy.wga.user.service.controller;

import com.yy.wga.common.core.dto.Result;
import com.yy.wga.user.feign.api.UserOfficialAccountFeign;
import com.yy.wga.user.feign.request.WxAuthCode2SessionReq;
import com.yy.wga.user.feign.response.WxAuthCode2SessionResp;
import com.yy.wga.user.service.manager.UserManager;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 微信公众号管理
 *
 * @author <a href="mailto:ludezh@dingtalk.com"> ludezh </a>
 * @version 1.0.0   2020/6/5,11:30
 * @since 1.0.0     2020/6/5,11:30
 */
@RestController
@RequestMapping(value = "/api/user/officialAccount/")
public class UserOfficialAccountController implements UserOfficialAccountFeign {
    @Resource
    private UserManager userManager;

    @Override
    @PostMapping("authCode2Session")
    public Result<WxAuthCode2SessionResp> authCode2Session(@Validated @RequestBody WxAuthCode2SessionReq request) {
        return Result.success(userManager.officialAccountAuthCode2Session(request));
    }
}
